package org.summerframework.component.security;


import org.summerframework.core.base.result.ResultCode;

/**
 * 返回code
 *
 * @author 石超
 * @version v1.0.0
 */
public enum RoleResultCode implements ResultCode {
    //
    SUCCESS(0, "success"),
    ERROR_NOT_HAS_ROlE(700, "没有该角色"),
    ERROR_ALREADY_HAVE_ROLE(701, "已经拥有该角色ID"),
    ERROR_NOT_HAS_PERMISSIONS(702, "没有该功能菜单"),
    ERROR_NOT_UPDATE_ICON_SYSTEM(703, "系统功能菜单不可修改图标"),
    ERROR_PERMISSIONS_DISABLE(704, "功能菜单停用"),
    ERROR_ROLE_DISABLE(705, "角色停用"),
    ERROR_PERMISSIONS_HAS_CODE(706, "此功能编码已创建, 请重试"),
    ERROR_PERMISSIONS_NOT_URL(707, "此功能未正确设置应用参数, 请联系管理员"),
    ERROR_PERMISSIONS_PARENT_ID_NOT_SELF(708, "功能菜单的上级不能是自己"),
    ERROR_PERMISSIONS_PARENT_ID_NOT_CHILD(709, "功能菜单的上级模块不能为自己的下级"),
    ERROR_PERMISSIONS_PARENT_ID_TOW_LEVEL(710, "功能菜单的菜单最大两级"),
    ERROR_PERMISSIONS_PARENT_ID_AND_CHILD_TOW_LEVEL(711, "功能菜单的菜单最大两级, 你的子菜单已经超出范围"),
    ERROR_NOT_DELETE_UPDATE_ADMIN(712, "超级管理员不允许修改"),
    ERROR_HAS_USER_ROLE(713, "目前有%d个正常用户在使用该角色，请先将这些用户禁用或删除"),
    ;
    private int code;

    private String msg;

    @Override
    public int getCode() {
        return code;
    }

    @Override
    public String getMsg() {
        return msg;
    }

    @Override
    public String toString() {
        return code + ":" + msg;
    }

    private RoleResultCode(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }
}
